#pragma once
#include "ModelMgr.h"
#include "RoadMgr.h"
#include "StatusMgr.h"
#include "core/CElapsedTimer.h"

class MgrController {
public:
	/**
	* @brief call per frame to update all entities in the scene.
	*/
	static FBO* updateAllEntities() {
		RoadMgr::get()->updateEntities();
		StatusMgr::get()->updateEntities();
		ModelMgr::get()->updateEntities();

		FBO* frontFBO = Scene::update();
		return frontFBO;
	}

	static void releaseAll() {
		static CElapsedTimer timer;
		timer.reset();
		int entitiesNum = Scene::entities().size();
		RoadMgr::get()->clear();
		ModelMgr::get()->clear();
		StatusMgr::get()->clear();

		Shader::resetGL();
		GLState::releaseBgTextures();
		LogI << "has released " << entitiesNum <<" entities, consume: " << timer.elapsed() << "ms";
	}
};